$(function(){
	$('#keyword').focus(function(){
		if ($(this).val() == '请输入搜索关键字') {
			$(this).val('');
		}
	}).blur(function(){
		if ($(this).val() == '') {
			$(this).val('请输入搜索关键字');
		}
	});
	$('#searchBtn').click(search);
});

function searchByKeyword(keyword) {
	if (keyword) {
		var url = '/product/list.html?skeyword=' + encodeURI(keyword);
		var fkey = $('#fkey').val();
		if (fkey) {
			url += '&fkey=' + encodeURI(fkey);
		}
		window.location.href = url;
	} 
}

function search(){
	var keyword = $('#keyword').val();
	if (!keyword || keyword == '请输入搜索关键字') {
		keyword = '';
	}
	searchByKeyword(keyword);
}

function listenerKeyDown(){
	var e = e || event;
	var currKey = e.keyCode||e.which||e.charCode;
	if(currKey == 13){
		search();
	}
}